#define _CRT_SECURE_NO_WARNINGS 1

#include <vector>
using namespace std;

class Solution {
public:
    vector<int> singleNumber(vector<int>& nums) {
        int n = 0;
        for (auto e : nums)
        {
            n ^= e;
        }
        n = n == INT_MIN ? n : (n & (-n));
        int ret1 = 0, ret2 = 0;
        for (auto e : nums)
        {
            if (e & n)
                ret1 ^= e;
            else
                ret2 ^= e;
        }

        return { ret1,ret2 };
    }
};